import Vue from 'vue'
import App from './App.vue'
import router from './router'
import vuetify from './plugins/vuetify'
import {
  QWebChannel
} from '../public/js/qwebchannel.js'

Vue.config.productionTip = false

if (typeof qt != 'undefined') {
  window.onload = function () {
    new QWebChannel(qt.webChannelTransport, (channel) => {
      // all published objects are available in channel.objects under
      // the identifier set in their attached WebChannel.id property
      Vue.prototype.userManage = channel.objects.userManage
      Vue.prototype.toolManage = channel.objects.toolManage
      Vue.prototype.toolDispense = channel.objects.toolDispense
      Vue.prototype.logManage = channel.objects.logManage

      new Vue({
        vuetify,
        router,
        render: h => h(App)
      }).$mount('#app')
    });
  }
}
else {
  new Vue({
    vuetify,
    router,
    render: h => h(App)
  }).$mount('#app')
}
